package com.cms.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cms.domain.Subject;
import com.cms.mapper.SubjectDao;
import com.cms.service.SubjectService;


@Service
public class SubjectServiceImpl implements SubjectService{

	@Autowired
	private SubjectDao entityDao;
	
	
	public Subject getById(String id){
		return entityDao.getById(id);
	}

	public List<Subject> getList(Subject searchEntity){
		return entityDao.getList(searchEntity);
	}
	
	public List<Subject> getList(int pageNum, int pageSize){
		int startIndex = 0;
		if(pageNum>1){
			startIndex = (pageNum-1)*pageSize;
		}
		return entityDao.getListForPage(startIndex, pageSize);
	}

	public void add(Subject entity){
		entity.setCreatetime(new Date());
		entityDao.add(entity);
	}

	public void update(Subject entity){
		entityDao.update(entity);
	}

	public void delete(Subject entity){
		entityDao.delete(entity);
	}

	public Integer getRowCount(){
		return entityDao.getRowCount();
	}
	
}

